//$(function(){
//    $("#a").click(function(){
//        //adding your code here
//    });
//});

var currentUser = new Object();
currentUser.id='test';

function vote(e, t) {
    var n = parseInt($("#up-" + e).text());
    r = parseInt($("#dn-" + e).text());
    s = t > 0 ? "up" : "dn";
    if(!$("#up-" + e).hasClass("disable") && !$("#dn-" + e).hasClass("disable")){
        showAnimation("vote-" + s + "-" + e, t),
            $.post("vote/"+currentUser.id + ":" + s + ":" + e);
        hidevotelink(e, s, n, r);
    }
}

function hidevotelink(e, t, n, r) {
    if("up" == t){
        $("#up-" + e).html(n+1);
        $("#vote-up-" + e).find("a").addClass("voted");
    } else {
        $("#dn-" + e).html(r-1);
        $("#vote-dn-" + e).find("a").addClass("voted");
    }
    $("#vote-up-" + e).find("a").addClass("disable"),
        $("#vote-dn-" + e).find("a").addClass("disable");
}

function showAnimation(e, t) {
    var o = $("#" + e),
        i = o.offset(),
        n = $('<div id="vote-ani" class="' + (t > 0 ? "pos" : "neg") + '" style="font-size:10px;z-index:1000">' + (t > 0 ? "+1" : "-1") + "</div>");
    n.appendTo("body"), i.top += 7, i.left += 30, 0 > t && (i.left += 5), n.offset(i).css("display", "block").animate({
        "font-size": "64px",
        opacity: 0,
        left: "-=40px"
    }, 350, "linear", function() {
        n.remove();
    });
}